diff options
| author | Factiven <[email protected]> | 2023-05-18 15:46:10 +0700 |
|---|---|---|
| committer | Factiven <[email protected]> | 2023-05-18 15:46:10 +0700 |
| commit | 759120279dbd83f787cc1005c0015955f8d64bc9 (patch) | |
| tree | be8d7dc74fe4a31d98dddbe59961e227649c49ec /pages/anime/[...id].js | |
| parent | Update [param].js (diff) | |
| download | moopa-759120279dbd83f787cc1005c0015955f8d64bc9.tar.xz moopa-759120279dbd83f787cc1005c0015955f8d64bc9.zip | |
Emergency Update
> Temporary switching to zoro as a source until the API works again
Diffstat (limited to 'pages/anime/[...id].js')
| -rw-r--r-- | pages/anime/[...id].js | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/pages/anime/[...id].js b/pages/anime/[...id].js index a2c84a4..c273d65 100644 --- a/pages/anime/[...id].js +++ b/pages/anime/[...id].js @@ -207,7 +207,9 @@ export default function Info({ info, color }) { setLoading(false); try { const [res] = await Promise.all([ - fetch(`https://api.moopa.my.id/meta/anilist/info/${id?.[0]}`), + fetch( + `https://api.moopa.my.id/meta/anilist/info/${id?.[0]}?provider=zoro` + ), // fetch("https://graphql.anilist.co/", { // method: "POST", // headers: { @@ -242,29 +244,30 @@ export default function Info({ info, color }) { ); const datas = await res.json(); - if (datas) { - const release = datas.results.map((i) => i.releaseDate); - const match = closestMatch(info.startDate.year, release); - const filter = datas.results.find((i) => i.releaseDate === match); - - // const found = filter.find((i) => i.title === info.title.romaji); - - // setLog(found); - - if (filter) { - const res = await fetch( - `https://api.moopa.my.id/anime/gogoanime/info/${filter.id}` - ); - const dataA = await res.json(); - setEpisode(dataA.episodes); - // setLog(dataA); - } - } else if (res.status === 500) { + // if (datas) { + // const release = datas.results.map((i) => i.releaseDate); + // const match = closestMatch(info.startDate.year, release); + // const filter = datas.results.find((i) => i.releaseDate === match); + + // // const found = filter.find((i) => i.title === info.title.romaji); + + // // setLog(found); + + // if (filter) { + // const res = await fetch( + // `https://api.moopa.my.id/anime/gogoanime/info/${filter.id}` + // ); + // const dataA = await res.json(); + // setEpisode(dataA.episodes); + // // setLog(dataA); + // } + // } + if (res.status === 500) { setEpisode(null); setEpiStatus("error"); setError(datas.message); } else { - setEpisode(datas.episodes); + setEpisode([]); } // setColor({ // backgroundColor: `${data?.color || "#ffff"}`, |